package backstage.menu.dao.impl;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import backstage.menu.dao.SysMenuDao;
import backstage.menu.pojo.SysMenu;

public class SysMenuDaoImpl extends HibernateDaoSupport implements SysMenuDao {

	public void seva(SysMenu s) {
		getHibernateTemplate().save(s);
	}

	public void update(SysMenu s) {
		getHibernateTemplate().update(s);
	}
	
	public void delete(SysMenu s) {
		getHibernateTemplate().delete(s);
	}

	public SysMenu getSysMenu(String labeling) {
		List<SysMenu> list = getHibernateTemplate().find("from SysMenu where labeling=?",labeling);
		if(list != null){
			return list.get(0);
		}else{
			return null;
		}
	}
	

	public SysMenu getSysMenuStruts(String labeling) {
		List<SysMenu> list = getHibernateTemplate().find("from SysMenu where labeling=? and state=?",new Object[]{labeling,1});
		if(list != null){
			return list.get(0);
		}else{
			return null;
		}
	}

	public List<SysMenu> getSysMenuList(String hql, Object[] values) {
		List<SysMenu> list = getHibernateTemplate().find(hql,values);
		return list;
	}


}
